--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="32"
+ height="32"
+ version="1.1"
+ id="svg3033"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="only32-svg.svg">
+ <metadata
+ id="metadata3041">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs3039" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="640"
+ inkscape:window-height="480"
+ id="namedview3037"
+ showgrid="false"
+ inkscape:zoom="11.313708"
+ inkscape:cx="16"
+ inkscape:cy="16.526174"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg3033" />
+ <text
+ x="16"
+ y="24"
+ font-size="24"
+ id="text3035"
+ style="font-size:24px;text-anchor:middle">16</text>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="32"
+ height="32"
+ version="1.1"
+ id="svg3033"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="only32-svg.svg">
+ <metadata
+ id="metadata3041">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs3039" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="640"
+ inkscape:window-height="480"
+ id="namedview3037"
+ showgrid="false"
+ inkscape:zoom="11.313708"
+ inkscape:cx="16"
+ inkscape:cy="16.526174"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg3033" />
+ <text
+ x="16"
+ y="24"
+ font-size="24"
+ id="text3035"
+ style="font-size:24px;text-anchor:middle">16</text>
+</svg>
}
static void
-assert_icon_lookup (const char *icon_name,
- gint size,
- GtkIconLookupFlags flags,
- const char *filename)
+assert_icon_lookup_size (const char *icon_name,
+ gint size,
+ GtkIconLookupFlags flags,
+ const char *filename,
+ gint pixbuf_size)
{
GtkIconInfo *info;
return;
}
+ if (pixbuf_size > 0)
+ {
+ GdkPixbuf *pixbuf;
+ GError *error = NULL;
+
+ pixbuf = gtk_icon_info_load_icon (info, &error);
+ g_assert_no_error (error);
+ g_assert_cmpint (gdk_pixbuf_get_width (pixbuf), ==, pixbuf_size);
+ g_object_unref (pixbuf);
+ }
+
g_object_unref (info);
}
+static void
+assert_icon_lookup (const char *icon_name,
+ gint size,
+ GtkIconLookupFlags flags,
+ const char *filename)
+{
+ assert_icon_lookup_size (icon_name, size, flags, filename, -1);
+}
+
static void
assert_icon_lookup_fails (const char *icon_name,
gint size,
"/icons/32x32/only32-symbolic.svg");
}
+static void
+test_svg_size (void)
+{
+ /* To understand these results, keep in mind that we never allow upscaling,
+ * and don't respect min/max size for scaling (though we do take it into
+ * account for choosing).
+ */
+ /* Check we properly load a svg icon from a sized directory */
+ assert_icon_lookup_size ("twosize-fixed", 48, 0, "/icons/32x32/twosize-fixed.svg", 32);
+ assert_icon_lookup_size ("twosize-fixed", 32, 0, "/icons/32x32/twosize-fixed.svg", 32);
+ assert_icon_lookup_size ("twosize-fixed", 20, 0, "/icons/32x32/twosize-fixed.svg", 32);
+ assert_icon_lookup_size ("twosize-fixed", 16, 0, "/icons/16x16/twosize-fixed.svg", 16);
+
+ /* Check that we still properly load it even if a different size is requested */
+ assert_icon_lookup_size ("twosize", 64, 0, "/icons/32x32s/twosize.svg", 64);
+ assert_icon_lookup_size ("twosize", 48, 0, "/icons/32x32s/twosize.svg", 48);
+ assert_icon_lookup_size ("twosize", 32, 0, "/icons/32x32s/twosize.svg", 32);
+ assert_icon_lookup_size ("twosize", 24, 0, "/icons/32x32s/twosize.svg", 24);
+ assert_icon_lookup_size ("twosize", 16, 0, "/icons/16x16s/twosize.svg", 16);
+ assert_icon_lookup_size ("twosize", 12, 0, "/icons/16x16s/twosize.svg", 12);
+ assert_icon_lookup_size ("twosize", 8, 0, "/icons/16x16s/twosize.svg", 8);
+}
+
int
main (int argc, char *argv[])
{
g_test_add_func ("/icontheme/force-regular", test_force_regular);
g_test_add_func ("/icontheme/rtl", test_rtl);
g_test_add_func ("/icontheme/symbolic-single-size", test_symbolic_single_size);
+ g_test_add_func ("/icontheme/svg-size", test_svg_size);
return g_test_run();
}